﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OrdersManage
{
    public class OrderDetails
    {
        private string name;
        public string Name
        {
            set { name = value; }
            get { return name; }
        }
        private int cnt = 0;
        public int Cnt
        {
            get { return cnt; }
            set { cnt = value; }
        }
        private double singlePrice = 0;
        public double SinglePrice
        {
            get { return singlePrice; }
            set { singlePrice = value; }
        }
        public OrderDetails(string name, int cnt, double singlePrice)
        {
            Name = name;
            Cnt = cnt;
            SinglePrice = singlePrice;
        }

        public override string ToString()
        {
            return "商品名：" + name + " 单价：" + singlePrice;
        }
        public double GetThisPrice()
        {
            return singlePrice * cnt;
        }
        public override bool Equals(object obj)
        {
            return obj is OrderDetails odd &&
                   name == odd.name;
        }
        public override int GetHashCode()
        {
            return name.GetHashCode();
        }
    }
   
}
